package com.weasel.weixin.commons.message.bean;

import com.thoughtworks.xstream.annotations.XStreamAlias;

import java.util.ArrayList;
import java.util.List;

/**回复图文消息
 * Created by Dylan on 2015/10/9.
 */
@XStreamAlias("xml")
public class WeiXinPostCommonXmlAnswerArticleMessage extends AbstractWeiXinPostCommonXmlAnswerMessage {

    public WeiXinPostCommonXmlAnswerArticleMessage(){
        setMsgType(ARTICLE_MESSAGE_TYPE);
    }

    @XStreamAlias("ArticleCount")
    private int articleCount;

    @XStreamAlias("Articles")
    private List<ArticleBody> articles = new ArrayList<>();

    public int getArticleCount() {
        return articles.size();
    }

    public void setArticleCount(int articleCount) {
        this.articleCount = articleCount;
    }

    public List<ArticleBody> getArticles() {
        return articles;
    }

    public void setArticles(List<ArticleBody> articles) {
        this.articles = articles;
    }

    public WeiXinPostCommonXmlAnswerArticleMessage addArticle(ArticleBody article){
        this.articles.add(article);
        return this;
    }

    @XStreamAlias("item")
    public static class ArticleBody{

        @XStreamAlias("Title")
        private String title;  //视频标题

        @XStreamAlias("Description")
        private String description;  //视频介绍

        @XStreamAlias("PicUrl")
        private String picUrl;  //图片链接，支持JPG、PNG格式，较好的效果为大图360*200，小图200*200

        @XStreamAlias("Url")
        private String url;  //点击图文消息跳转链接

        public String getTitle() {
            return title;
        }

        public void setTitle(String title) {
            this.title = title;
        }

        public String getDescription() {
            return description;
        }

        public void setDescription(String description) {
            this.description = description;
        }

        public String getPicUrl() {
            return picUrl;
        }

        public void setPicUrl(String picUrl) {
            this.picUrl = picUrl;
        }

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }
    }
}
